-
Notifications
You must be signed in to change notification settings - Fork 274
Fix toolkit connection dropdown hiding when panel is small #4933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Okay, this should be a 1 line fix but I am running into some versioning issues. The current line that we have that sets the layout policy uses a deprecated function that as of 2024.1 does not work(the documentation says this does nothing) Replacing that with the new LayoutStrategy (instead of policy) works for the new versions, but does not compile for 2023.3 since it cannot resolve the references to the new ToolbarLayout Class in the import statement. layoutPolicy -- old and only works for 2023.3 <=. No effect for new versions, and the default behavior seems to have changed from NOWRAP to AUTO layoutStrategy -- new method for layout. seems to default to AUTO for instead of NOWRAP, works for new versions, doesn't compile for old versions since it imports a new package only available 2024.1 >= Added in some logic to check the version, since importing and referencing com.intellij.openapi.actionSystem.toolbarLayout in old versions seems to break it. I think once 2024.3 releases and we stop supporting 2023.3 we can change this to one single line: |
…own' into samgst/FixToolkitConnectionDropdown # Conflicts: # plugins/toolkit/jetbrains-core/src/software/aws/toolkits/jetbrains/core/explorer/AwsToolkitExplorerToolWindow.kt
manodnyab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a screenshot of the new dropdown to the description of the PR?
| ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, group, true).apply { | ||
| layoutStrategy = ToolbarLayoutStrategy.NOWRAP_STRATEGY | ||
| setTargetComponent(toolWindow) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since only this section differs across the versions, can we move the creation of this component to the util file and retain the creation for the panel in the init block of AWSToolkitExplorerToolWindow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done & done, Thanks for the feedback :)
|
|
||
| import com.intellij.openapi.actionSystem.ActionToolbar | ||
|
|
||
| object ActionToolbarLayoutUtil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably dont need this object, it can be a standalone function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
…own' into samgst/FixToolkitConnectionDropdown # Conflicts: # plugins/toolkit/jetbrains-core/src-233/software/aws/toolkits/jetbrains/core/explorer/ActionToolbarLayoutUtil.kt # plugins/toolkit/jetbrains-core/src-241+/software/aws/toolkits/jetbrains/core/explorer/ActionToolbarLayoutUtil.kt # plugins/toolkit/jetbrains-core/src/software/aws/toolkits/jetbrains/core/explorer/AwsToolkitExplorerToolWindow.kt
| package software.aws.toolkits.jetbrains.core.explorer | ||
|
|
||
| import com.intellij.openapi.actionSystem.ActionToolbar | ||
|
|
||
| fun setToolbarLayout(toolbar: ActionToolbar) { | ||
| toolbar.layoutPolicy = ActionToolbar.NOWRAP_LAYOUT_POLICY | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToolbarLayoutStrategy doesn't exist in 233, so it would be less overall work if we just aliased
ToolbarLayoutStrategy.NOWRAP_STRATEGY to be ActionToolbar.NOWRAP_LAYOUT_POLICY i n233


Types of changes
Description
Updated ActionToolbar's layout strategy to ensure no wrapping or auto-hide occurs when components don't fit into the toolbar. This change also replaces the Deprecated layoutPolicy method.
OLD BEHAVIOR:

NEW BEHAVIOR:

Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.